package com.htjc.integral.interaction.inner.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.htjc.integral.interaction.inner.service.InvokeService;
import com.htjc.integral.interaction.inner.util.AxisOneClient;
import com.htjc.integral.interaction.inner.util.Constance;
import com.htjc.integral.interaction.inner.util.CxfClient;
import org.springframework.core.env.Environment;

import lombok.extern.slf4j.Slf4j;

@Slf4j(topic="innerLogger")
@Service
public class InvokeServiceImpl implements InvokeService{
	@Autowired
    private Environment env;

	@Override
	public Object invokeQuery(String req,String proviceCode,String wsdlUrl,String targetNameSpace,String method,String serPath,String serMethodName,String userName,String passWord) {
		log.info("\n\n\n "+InvokeServiceImpl.class.getName()+"方法名：invokeQuery()渠道端内网应用积分e+内网服务接口=====start=====");
		
		log.info("方法：invokeQuery()++++++++++接收的请求参数req:"+req);
		log.info("请求参数:=====wsdlUrl："+wsdlUrl+"=====targetNameSpace:"+targetNameSpace+"=====method:"+method+"=====serPath:"+serPath+
				"=====serMethodName:"+serMethodName+"=====username:"+userName+"=====password:"+passWord);
		
		Object obj= null;
		if(Constance.PROVINCE_HENAN.equals(proviceCode)) {
			obj = CxfClient.cxfFun(req,wsdlUrl,targetNameSpace,method)[0];
		}else {
			obj = AxisOneClient.axis(req,wsdlUrl,targetNameSpace,method,serPath,serMethodName,userName,passWord);
		}
		log.info("返回值:"+obj);
		
		
		log.info(InvokeServiceImpl.class.getName()+"方法名：invokeQuery()渠道端内网应用积分e+内网服务接口=====end=====");
		return obj;
	}
}
